#pragma once
#include "glm/glm.hpp"
using namespace glm;
#define RAY_MIN_DIST 0.0005f
#define RAY_MAX_DIST 1e30f
class Ray
{
public:
	Ray(vec4 _origin, vec4 _dir, int _MaxDepth, int _curDepth, int _type);
	~Ray();

	void updateInvDir();

	vec4 origin(){ return orig; }
	vec4 direction(){ return dir; }
	vec4 invDirection(){ return invDir; }
	int maxDepth(){ return max_depth; }
	
	void toString();
	int type(){ return rayType; }

	vec4 pointAtDepth(float _d);		//returns a point on the ray at the indicated depth
	int depth(){ return theDepth; }

	float minDist(){ return RAY_MIN_DIST; }
	float maxDist(){ return RAY_MAX_DIST; }

	int sign[4];

	void transform(mat4 _rotate, vec4 _translate);		//transform the ray using the given rotation and translation vectors

private:
	//origin
	vec4 orig;
	//direction
	vec4 dir;
	//inverse direction
	vec4 invDir;
	//depth
	int max_depth;
	//type?
	int rayType;	//0 = camera, 1 = shadow, 2 = reflect, 3 = transmission
	
	int theDepth;
};

